package com.surfilter.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.surfilter.bean.MapData;
import com.surfilter.bean.QueryResult;
import com.surfilter.service.PhoneService;

@Controller
public class PhoneController {
	@Autowired
	private PhoneService phoneService;
	
	@RequestMapping("/phone")
	public String phone(Map<String,Object> map) throws Exception{
        return "phoneSY";
    }
	
	@RequestMapping("/phone/queryAccountAnalysis")
	@ResponseBody
	public Object queryAccountAnalysis(MapData mapData) throws Exception{
		List<MapData> queryAccountAnalysis = phoneService.queryAccountAnalysis(mapData);
        return queryAccountAnalysis;
    }
	
	@RequestMapping("/phone/queryAccountStatistic")
	@ResponseBody
	public Object queryAccountStatistic(MapData mapData) throws Exception{
		Map<String, Object> queryAccountStatistic = phoneService.queryAccountStatistic(mapData);
        return queryAccountStatistic;
    }
	
	@RequestMapping("/phone/queryTask/{pageNum}")
    @ResponseBody
    public Object queryTask(@PathVariable String pageNum) throws Exception{
		return phoneService.queryAccountTask(Integer.parseInt(pageNum));
    }
	
	@RequestMapping("/phone/queryResult/{set_Id}")
    @ResponseBody
    public Object queryResult(@PathVariable String set_Id,String page,String limit) throws Exception{
		QueryResult queryResult = new QueryResult();
		queryResult.setPageNum(Integer.parseInt(page));
		queryResult.setSet_Id(Long.parseLong(set_Id));
		queryResult.setLimit(Integer.parseInt(limit));
		return phoneService.queryAccountResult(queryResult);
    }
	
	@RequestMapping("/phone/queryAccountTrack")
	@ResponseBody
	public Object queryAccountTrack(MapData mapData) throws Exception{
		Map<String, Object> queryAccountTrack = phoneService.queryAccountTrack(mapData);
        return queryAccountTrack;
    }
	
	@RequestMapping("/phone/queryPositionAnalysis")
	@ResponseBody
	public Object queryPositionAnalysis(MapData mapData) throws Exception{
		Map<String, Object> queryPositionAnalysis = phoneService.queryPositionAnalysis(mapData);
        return queryPositionAnalysis;
    }
}
